<!---->
<template>
    <div>
        <div style="font-size:23px">在线留言></div>
        <el-alert
            title="感谢您对本系统提出宝贵意见！"
            type="success"
            :closable="false">
        </el-alert>
        <el-tabs type="border-card" style="height:500px">
                <el-tab-pane label="用户留言">
                        <el-form label-position="right" label-width="80px" ref="FormStu" :model="FormStu">
                        <el-form-item label="邮箱" 
                        prop="email"
                        :rules="[
                        { required: true, message: '邮箱不能为空'},
                        ]">
                            <el-input style="width:300px" clearable v-model="FormStu.email"></el-input>
                        </el-form-item>
                        <el-form-item label="信息"
                        prop="message"
                         :rules="[
                        { required: true, message: '信息不能为空'}
                        
                        ]">
                            <el-input type="textarea" style="width:300px" clearable v-model="FormStu.message"></el-input>
                        </el-form-item>
                        
                        <el-form-item>
                             <el-button @click="submitForm('FormStu')" :loading="loading" type="primary">提 交</el-button>
                        </el-form-item>
                        </el-form>
                </el-tab-pane>

                
                
        </el-tabs>
    </div>
</template>
<script>
export default {
    data() {
        return {
            FormStu:{
                email:"",
                message:''
            },
            loading:false
        }
    },
    created(){

    },
    methods: {
        submitForm(formName){
            this.loading = true;
                this.$refs[formName].validate((valid) => {
                if (valid) {
                         this.$api.post("/feedback/addFeedback",this.FormStu,res=>{
                                this.FormStu.message ="";
                                this.formName.email =""
                         })
                         
                    }
                })
                setTimeout(()=>{
                    this.loading = false;
                    this.$message.success("感谢反馈！");
                },1000)
        }
    },
}
</script>
<style scoped>

</style>